import 'package:sqflite/sqlite_api.dart';

import 'manager/db_provider.dart';

class DBGoods extends BaseDbProvider {
  final String tabName = "gk_order";

  final String columnId = "_id";

  @override
  tableName() {
    return tabName;
  }

  @override
  tableSqlString() {
    return tableBaseString(tabName, columnId) + "goodsId text)";
  }

  Future insert(String goodsId) async {
    Database db = await getDataBase();
    Map<String, dynamic> map = Map();
    map["goodsId"] = goodsId;
    return await db.insert(tabName, map);
  }

  Future<Set<String>> queryAll() async {
    Database db = await getDataBase();
    List<Map<String, dynamic>> maps = await db.query(tabName);
    Set<String> result = Set();
    maps.forEach((map) {
      result.add(map["goodsId"]);
    });
    return result;
  }
}
